import VMessage from './newInstance'

let VMessageInstance

function getInstance() {
  VMessageInstance = VMessageInstance || VMessage.newInstance()
  return VMessageInstance
}

function notice({ message = '', duration = 2000, type = 'success', showClose = false }) {
  const instance = getInstance()
  instance.add({
    message,
    type,
    duration,
    showClose
  })
}

export default notice
